﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebApp.BLL.Service
{
    public class AccessToken
    {
        public string userId { get; set; }
        public string token { get; set; }
        public string md5 { get; set; }
        public DateTime expire { get; set; }

        public AccessToken()
        {

        }

        public override string ToString()
        {
            return Common.AES.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(this));
        }

        #region Create

        public static AccessToken Create(string access_token)
        {
            var json = Common.AES.Decrypt(access_token);

            return Newtonsoft.Json.JsonConvert.DeserializeObject<AccessToken>(json);
        }

        #endregion

    }
}
